let domain = require('../domain/lifecycleDomain');

let commonDao = require('../../../dao/commonDao');
let userInfoServices = require('../../../services/userInfoServices');
let dispatch = require('../../../util/dispatcher');
let rpcAPI = require('../../../API/rpcAPI');
let code = require('../../../constant/code')
let logger = require('pomelo-logger').getLogger("robot");

module.exports = function (app) {
    return new remote(app);
};

let remote = function (app) {
    this.app = app;
};
let pro = remote.prototype;

pro.getGameControllerData = async function (kind, cb) {

    let robotData = await commonDao.findData('robotSetting', { kind }, null, 0, 0);
    cb(null, robotData)


};


pro.modifyInventoryValue = async function (uid, kind, count, cb) {

    let robotData = await commonDao.updateData('robotSetting', { kind }, { $inc: { curInventoryValue: count } });
    cb(null, robotData);


};


pro.updateGameControllerData = async function (kind, data, cb) {

    let robotData = await commonDao.findOneAndUpdateEx('robotSetting', { kind }, data, { upsert: true, new: true });
    cb(null, robotData);


};
